python 官网
1. linux 的 python 安装
CentOS 6.5 系统自带 Python 2.6
1 2
| [root@192 ~] python-2.6.6-51.el6.x86_64
|
CentOS 7.0 系统自带 PYthon 2.7
1 2
| [root@localhost ~] python-2.7.5-48.el7.x86_64
|
在 linux 系统下,直接输入 python 就可以进入 pyhton 的命令行模式,使用 exit()
退出
1 2 3 4 5 6
| [root@192 ~] Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print 'hello world' hello world
|
原生的 python 带的命令行不是很多,也不能使用 tab 键命令补齐。这时候需要安装一个 python shell 模块,叫 “ipython” 的模块,就可以进行命令补齐。
如果计算机可以上网,那么可以直接使用网络安装,使用 命令 pip ,如果没有这个命令,需要先安装,需要先安装 epel 扩展源
安装完成后再安装 ipython
因为 CentOS 6.5 自带的 python 为 2.6 版本比较底,直接 pip 安装有可能高版本会报错,需要在包名后边加上低版本版本号,来安装较低版本。
查看安装模块命令 pip list
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| [root@192 ~] You are using pip version 7.1.0, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. argparse (1.2.1) distribute (0.6.10) iniparse (0.3.1) ipython (1.2.1) pip (7.1.0) pycurl (7.19.0) pygpgme (0.1) pyxdg (0.18) setuptools (0.6rc11) urlgrabber (3.9.1) yum-metadata-parser (1.1.2)
|
安装完成,直接输入 ipython 就可以进如 python 命令行模式的,这个模式下可以使用 tab 键进行命令补齐了,退出使用命令 exit
1 2 3 4 5 6 7 8 9 10 11
| [root@192 ~] Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22) Type "copyright", "credits" or "license" for more information. IPython 1.2.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]:
|
安装 ipython 报错

使用命令
如果机器不能上网,那么需要在可以上网的机器上下载安装包拷贝到机器上安装。下载地址
然后拷贝到机器解压

解压以后有个 setup.py 脚本

使用命令 setup.py install 安装,安装完成使用 pip list
查看是否安装成功。
2.windows 安装 python (只需要了解即可)
首先在Python官网 下载 python 安装包

下载安装以后,c 盘下会有一个 python 文件夹


然后把 python 路径加入 windows 的环境变量




进入 cmd 命令行模式,输入 python 就可以进入 python 命令行模式
